#pragma once
#include <iostream>
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>

const std::string gpipefile = "./fifo";
const mode_t gmode = 0600;
const int gdefaultfd = -1;
const int gsize = 1024;
const int gForwriteopen = O_WRONLY;
const int gForreadopen = O_RDONLY;

//打开管道文件
int OpenPipeFile(int flag)
{
    int fd = ::open(gpipefile.c_str(),flag);
    if(fd < 0)
    {
        std::cerr<<"open fail"<<std::endl;
    }
    return fd;
}



//关闭管道文件
void ClosePipeHelper(int fd)
{
    if(fd >= 0)
    ::close(fd);
}